package org.xxpay.pay.channel.xx2pay;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * @description: xx2pay
 */
@Component
public class Xx2payConfig {

    public static final String CHANNEL_NAME = "xx2pay"; //渠道名称

    private String mchId; // 商户ID

    private String key;  // 商户Key

    private String reqUrlHost;  // 请求地址域名

    private String appId; //应用ID

    public Xx2payConfig(){}

    public Xx2payConfig(String payParam) {
        Assert.notNull(payParam, "init xx2pay config error");
        JSONObject object = JSONObject.parseObject(payParam);
        this.mchId = object.getString("mchId");
        this.key = object.getString("key");
        this.reqUrlHost = object.getString("reqUrlHost");
        this.appId = object.getString("appId");
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getReqUrlHost() {
        return reqUrlHost;
    }

    public void setReqUrlHost(String reqUrlHost) {
        this.reqUrlHost = reqUrlHost;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }
}
